#include "SDLWindow.h"
#include "BZPModel.h"
#include "BZPView.h"
#include "BZPController.h"
#include "Properties.h"
#include "ClientSocket.h"
#include <iostream>

int main(int argc, char **argv) {
	Properties properties;
	SDLWindow window;
	window.init();
	window.createWindow();
	window.createRenderer();
	BZPModel model;
	BZPView view(&window, &model);
	std::string host = properties.getProperty("ip_servidor");
	int port = properties.getPropertyAsInt("puerto");
	int portListener = properties.getPropertyAsInt("puerto.escucha");
	ClientSocket socket(host, port);
	ClientSocket socketReceptor(host, portListener);
	try {
		BZPController controller(&view, &model, socket, socketReceptor);
		view.init(&controller);
		controller.mainLoop();
	} catch(ComunicacionException& e){
		std::cout << "Error en apertura de conexion" << std::endl;
	}
}

/* TEST SOCKETS */
/*
 #include <stdio.h>
 #include <stdlib.h>
 #include <string>
 #include "ProcesoClient.h"
 #include <iostream>

 using std::cout;
 using std::endl;

 int main() {
 cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!

 ProcesoClient procesoClient;
 procesoClient.comenzarClient();

 return 0;
 }

 */
